package com.CST.controller.cb;


import com.CST.common.api.ResultObject;
import com.CST.dto.cb.DateDTO;
import com.CST.entity.cb.EtlSalary;
import com.CST.service.cb.IEtlSalaryService;
import com.CST.vo.cb.SalaryDetailByAccIdVO;
import io.swagger.annotations.*;

import java.util.*;

import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ly
 * @since 2022-01-24
 */
@Api(tags = {"薪酬数据"})
@RestController
@RequestMapping("/etlSalary")

public class EtlSalaryController {

    @Autowired
    private IEtlSalaryService etlSalaryService;

    @PostMapping("/getEtlSalarySource")
    @ApiOperation("获取薪酬数据(由于条数较多,请尽量写全条件查找)")
    public ResultObject getEtlSalarySource(@RequestBody EtlSalary entity) {
        return etlSalaryService.getEtlSalarySource(entity);
    }

    @PostMapping("/getEtlSalaryPageSource")
    @ApiOperation("获取页面薪酬数据(收入部分)")
    public ResultObject getEtlSalaryPageSource(@RequestBody EtlSalary entity) {
        return etlSalaryService.getEtlSalaryPageSource(entity);
    }

    /**
     * 获取所有父级科室人员经费详情
     * 按照所有父级科室账套分组
     */
    @PostMapping("/listPersonalSalaryDetail/{pDeptCode}")
    @ApiOperation("以账套为列，获取所有父级科室的人员经费详情")
    public ResultObject listPersonalSalaryDetail(@RequestBody DateDTO dateDTO, @PathVariable String pDeptCode) {
        List<SalaryDetailByAccIdVO> list = etlSalaryService.listPersonalSalaryDetail(dateDTO, pDeptCode);
        return ResultObject.successReturn(list);
    }

}

